package com.exm.collectcodenew.juc.threadPool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

//缓存线程池。没有核心线程，普通线程数量为Integer.MAX_VALUE（可以理解为⽆限），线程闲置60s后回收，
//任务队列使用SynchronousQueue这种⽆容量的同步队列。适用于任务量大但耗时低的场景。
public class CachedThreadPoolTest {
    public static void main(String args[]) {
        ExecutorService cachedThreadPool = Executors.newCachedThreadPool();
        cachedThreadPool.execute(new Runnable(){
            public void run() {
                System.out.println(Thread.currentThread().getName() + "--->运行");
            }
        });
        cachedThreadPool.shutdown();
    }
}
